package com.itheima.test0906.test06;

import java.util.Scanner;

public class MathTest {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("请输入一个数，求其绝对值");
        int i = scanner.nextInt();
        System.out.println("其绝对值为：" + Math.abs(i));

        System.out.print("请输入一个数，向上取整");
        double v = scanner.nextDouble();
        System.out.println("其向上取整为：" + Math.ceil(v));

        System.out.print("请输入一个数，四舍五入");
        v = scanner.nextDouble();
        System.out.println("其四舍五入为：" + Math.round(v));

        System.out.print("请输入一个数，向下取整");
        v = scanner.nextDouble();
        System.out.println("其向下取整为：" + Math.floor(v));

        System.out.print("请输入两个数，求其较大值");
        int i1 = scanner.nextInt();
        int i2 = scanner.nextInt();
        System.out.println("其中较大值为" + Math.max(i1,i2));

        System.out.print("请输入两个数，求其较小值");
        i1 = scanner.nextInt();
        i2 = scanner.nextInt();
        System.out.println("其中较小值为" + Math.min(i1,i2));

        System.out.print("请输入两个数，求其a的b次幂");
        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        System.out.println("其中较小值为" + Math.pow(a,b));

//        System.out.print("请输入两个数，求其a的b次幂");
//        double a = scanner.nextDouble();
//        double b = scanner.nextDouble();
        System.out.print("其中较小值为" + Math.random());



    }
}
